package com.jswlw.service.biz.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jswlw.dao.biz.BillSetMapper;
import com.jswlw.entity.biz.BillSet;
import com.jswlw.service.biz.BillSetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class BillSetServiceImpl implements BillSetService {
    @Autowired
    BillSetMapper mapper;

    @Override
    public void add(BillSet billSet) {
        billSet.setCreateTime(new Date());
        mapper.insertSelective(billSet);
    }

    @Override
    public void update(BillSet billSet) {
        mapper.updateByPrimaryKeySelective(billSet);
    }

    @Override
    public void delete(Integer id) {
        mapper.deleteByPrimaryKey(id);
    }

    @Override
    public BillSet find4Id(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public List<BillSet> queryList(BillSet filter) {
        return mapper.queryList(filter);
    }

    @Override
    public Page<BillSet> queryPage(BillSet billSet, Integer offset, Integer limit) {
        PageHelper.startPage(offset, limit);
        return (Page<BillSet>) mapper.queryList(billSet);
    }
}
